from google.appengine.api import channel
from app.web import abstract

class Action(abstract.Action):
    
    def get(self):
        
        client_id = self.param("client_id")
        recipient = self.param("recipient")

        token = channel.create_channel("test" + client_id)
        
        params = {"channel_token" : token, "recipient" : recipient}
        
        self.render("channel", params)
        
        
    def post(self):
        
        client_id = self.param("recipient")
        message = self.param("message")
        
        channel.send_message("test" + client_id, message)
